﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PIMS.WorkPlugin.WMS
{

    public class Msg_WMS
    {/// <summary>
     /// 请求ID 唯一值
     /// </summary>
        [Required(ErrorMessage = "请求ID不能为空")]
        //[StringLength(24, ErrorMessage = "请求ID长度必须为24位")]
        public string requestId { get; set; }

        /// <summary>
        /// 下线产线；字典值提前共享
        /// </summary>
        [Required(ErrorMessage = "产线编号不能为空")]
        [StringLength(2, ErrorMessage = "产线编号长度必须为2位")]
        public string locNo { get; set; }

        /// <summary>
        /// 订单号
        /// </summary>
        [Required(ErrorMessage = "订单号不能为空")]
        [StringLength(12, ErrorMessage = "订单号长度必须为12位")]
        public string orderNo { get; set; }

        /// <summary>
        /// 牌号
        /// </summary>
        [Required(ErrorMessage = "牌号不能为空")]
        [StringLength(18, ErrorMessage = "牌号长度不能超过18位")]
        public string brand { get; set; }

        ///// <summary>
        ///// 物料编号
        ///// </summary>
        //[Required(ErrorMessage = "物料编号不能为空")]
        //[StringLength(18, ErrorMessage = "物料编号长度不能超过18位")]
        //public string MaterNo { get; set; }

        ///// <summary>
        ///// 物料名称
        ///// </summary>
        //[Required(ErrorMessage = "物料名称不能为空")]
        //[StringLength(80, ErrorMessage = "物料名称长度不能超过80位")]
        //public string MaterName { get; set; }

        /// <summary>
        /// 批次
        /// </summary>
        [Required(ErrorMessage = "批次不能为空")]
        [StringLength(10, ErrorMessage = "批次长度不能超过10位")]
        public string batchNo { get; set; }

        /// <summary>
        /// 重量（数量）单位：吨
        /// </summary>
        [Required(ErrorMessage = "重量不能为空")]
        [Range(0, 9999999999.999, ErrorMessage = "重量值必须在0-9999999999.999之间")]
        public decimal weight { get; set; }

        /// <summary>
        /// 托盘号
        /// </summary>
        [Required(ErrorMessage = "托盘号不能为空")]
        [StringLength(20, ErrorMessage = "托盘号长度不能超过20位")]
        public string palletNo { get; set; }

        /// <summary>
        /// 生产时间
        /// </summary>
        [Required(ErrorMessage = "生产时间不能为空")]
        public string productionTime { get; set; }

        /// <summary>
        /// 备用字段1
        /// </summary>
        [StringLength(255, ErrorMessage = "备用字段1长度不能超过255位")]
        public string param1 { get; set; }

        /// <summary>
        /// 备用字段2
        /// </summary>
        [StringLength(255, ErrorMessage = "备用字段2长度不能超过255位")]
        public string param2 { get; set; }

        /// <summary>
        /// 备用字段3
        /// </summary>
        [StringLength(255, ErrorMessage = "备用字段3长度不能超过255位")]
        public string param3 { get; set; }

        /// <summary>
        /// 产品等级
        /// </summary>
        public int productGrade { get; set; } 
        /// <summary>
        /// 业务类型： 1、生产入库  2、退货入库
        /// </summary>
        public int productType { get; set; } 
        /// <summary>
        /// 是否满盘
        /// </summary>
        public int isFull { get; set; }
        ///<summary>
        /// 包装材质0-木托盘1-塑料托盘
        /// </summary>
        public int wrapper { get; set; }
        /// <summary>
        /// 是否尾托  （0 否 1 是）
        /// </summary>
        public int isLast { get { return (1 - isFull); }  }

    }

    public class Msg_WMS_Return
    {
        /// <summary>
        /// 请求ID 唯一值
        /// </summary>
        [Required(ErrorMessage = "请求ID不能为空")]
        public string RequestId { get; set; }

        /// <summary>
        /// 状态码：0表示成功，非0表示失败
        /// </summary>
        [Required(ErrorMessage = "状态码不能为空")]
        public string ErrCode { get; set; }

        /// <summary>
        /// 描述信息
        /// </summary>
        public string ErrMess { get; set; }

        /// <summary>
        /// 响应时间戳
        /// </summary>
        public DateTime ResponseTime { get; set; } = DateTime.Now;

        /// <summary>
        /// 判断响应是否成功
        /// </summary>
        public bool IsSuccess => ErrCode == "0";
        ///// <summary>
        ///// 请求ID 唯一值
        ///// </summary>
        //public string requestId { get; set; }
        ///// <summary>
        ///// 状态码0表示成功，非0表示失败
        ///// </summary>
        //public string errCode { get; set; }
        ///// <summary>
        ///// 描述信息
        ///// </summary>
        //public string errMess { get; set; }
    }
}
